import MySQLdb
import _mysql_exceptions
cxn=MySQLdb.connect(db='pachong',host='localhost',user='root',passwd='123456ms')
cxn.set_character_set('utf8')
cur=cxn.cursor()

sql='insert into iteye (id,url,update_time,file_length,update_fre) values(%s,%s,%s,%s,%s)'

try:
    cur.execute(sql,(str(1181094),'a','b','1','1'))    
except _mysql_exceptions.IntegrityError,e:
    print type(e)

cxn.commit()
cur.close()
cxn.close()
